package sse.ustc.cc.activity;

import sse.ustc.cc.base.TabBase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MonthEntryAty extends TabBase implements OnClickListener {

	private Class<?> activities[] = {MonthClassInfoAty.class, FileAty.class, CourseAty.class, LoginAty.class};
	
	private Button[] btn = new Button[4];
	
	private int currentSelect;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		setContainer(R.id.fl_container);
		btn[0] = (Button) findViewById(R.id.btn_one);
		btn[0].setOnClickListener(this);
		btn[1] = (Button) findViewById(R.id.btn_two);
		btn[1].setOnClickListener(this);
		btn[2] = (Button) findViewById(R.id.btn_three);
		btn[2].setOnClickListener(this);
		btn[3] = (Button) findViewById(R.id.btn_four);
		btn[3].setOnClickListener(this);
		showActivity(activities[0]);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		btn[currentSelect].setBackgroundResource(R.color.darkslategray);
		switch (v.getId()) {
		case R.id.btn_one:
			currentSelect = 0;
			btn[0].setBackgroundResource(R.color.blue);
			showActivity(activities[0]);
			break;
		case R.id.btn_two:
			currentSelect = 1;
			btn[1].setBackgroundResource(R.color.blue);
			showActivity(activities[1]);
			break;
		case R.id.btn_three:
			currentSelect = 2;
			btn[2].setBackgroundResource(R.color.blue);
			showActivity(activities[2]);
			break;
		case R.id.btn_four:
			currentSelect = 3;
			btn[3].setBackgroundResource(R.color.blue);
			showActivity(activities[3]);
			break;
		}
	}
}
